ped_filter.c

Go to the documentation of this file.
00001 /*
00002  * $Id: ped_filter.c 366303 2010-03-05 13:14:01Z taoliu $
00003  * 
00004  * This code is provided as is by Juniper Networks SDK Developer Support.
00005  * It is provided with no warranties or guarantees, and Juniper Networks
00006  * will not provide support or maintenance of this code in any fashion.
00007  * The code is provided only to help a developer better understand how
00008  * the SDK can be used.
00009  *
00010  * $Id: ped_filter.c 366303 2010-03-05 13:14:01Z taoliu $
00011  *
00012  * Copyright (c) 2007-2008, Juniper Networks, Inc.
00013  * All rights reserved.
00014  */
00015 
00028 #include <sync/common.h>
00029 #include <jnx/provider_info.h>
00030 #include <jnx/junos_dfw_api.h>
00031 #include "ped_filter.h"
00032 #include "ped_services.h"
00033 #include "ped_script.h"
00034 
00035 #include PE_OUT_H
00036 
00037 /*** Constants ***/
00038 
00042 #define INIT_FILTER_FILENAME "ped_init_filter.xsl"
00043 
00047 #define APPLY_FILTER_FILENAME "ped_update_interface_filter.xsl"
00048 
00049 /*** Data Structures ***/
00050 
00051 static junos_dfw_session_handle_t dfw_handle; 
00052 static junos_dfw_client_id_t      cid;        
00053 static boolean pfd_on = FALSE;                
00054 static boolean ready = FALSE;                 
00055 static junos_dfw_filter_info_t pfd_filter_info; 
00056 static char * make_pfd_filter_on_int;          
00057 
00058 /*** STATIC/INTERNAL Functions ***/
00059 
00070 static int
00071 get_unit(char * ifname)
00072 {
00073     char * p = ifname;
00074     
00075     while(*p != '\0' && *p != '.') {
00076         ++p;
00077     }
00078     
00079     if(*p != '\0') { // found dot
00080         *p = '\0'; // turn the dot to a \0
00081         ++p;
00082         return strtol(p, NULL, 0);
00083     } else {
00084         return -1;
00085     }
00086 }
00087 
00088 
00105 static void
00106 session_connect(junos_dfw_session_handle_t handle,
00107                 junos_dfw_session_connect_return_t code,
00108                 junos_dfw_client_id_t * client_id_list,
00109                 int num_client_ids)
00110 {
00111     junos_dfw_term_info_t i_dti;
00112     junos_dfw_trans_handle_t trans_hdl;
00113     
00114     INSIST_ERR(handle == dfw_handle);
00115     
00116     if(code == JUNOS_DFW_SC_SUCCESS) {
00117         
00118         if(num_client_ids > 1) {
00119             ERRMSG(PED, LOG_ERR,
00120                     "%s: Found more than one client ID", __func__);            
00121         }
00122         
00123         if(client_id_list != NULL) {
00124             
00125             cid = client_id_list[0]; // get dynamic ID assigned 
00126             junos_trace(PED_TRACEFLAG_FILTER,
00127                         "%s: Connected to dfwd", __func__);
00128             
00129             if(junos_dfw_trans_purge(dfw_handle,
00130                     client_id_list, num_client_ids)) {
00131                 ERRMSG(PED, LOG_ERR,
00132                         "%s: Failed to perform initial DFWD purge", __func__);
00133             }
00134             
00135             ready = TRUE;
00136             
00137             if(make_pfd_filter_on_int != NULL) {
00138                 // Create filter pointing to PFD routing instance
00139                 
00140                 junos_trace(PED_TRACEFLAG_FILTER, "%s: creating PFD filter",
00141                         __func__);
00142                 
00143                 bzero(&pfd_filter_info, sizeof(pfd_filter_info));
00144                 snprintf(pfd_filter_info.namestr_key, 
00145                      sizeof(pfd_filter_info.namestr_key), "TO_PFD_ON_INGRESS");
00146                 pfd_filter_info.owner_client_id = cid;
00147                 pfd_filter_info.addr_family = JUNOS_DFW_FILTER_AF_INET;
00148 
00149                 pfd_filter_info.type = JUNOS_DFW_FILTER_TYPE_CLASSIC;
00150 
00151                 // Create the filter add transaction 
00152                 
00153                 if(junos_dfw_filter_trans_alloc(&pfd_filter_info,
00154                         JUNOS_DFW_FILTER_OP_ADD, &trans_hdl)) {
00155                     ERRMSG(PED, LOG_ERR,
00156                            "%s: junos_dfw_filter_trans_alloc failed", __func__);
00157                     return;
00158                 }
00159 
00160                 // Add a term to the filter
00161                 
00162                 bzero(&i_dti, sizeof(i_dti));
00163                 strlcpy(i_dti.namestr_key, "TO_PFD_TERM", 
00164                         sizeof(i_dti.namestr_key));
00165                 i_dti.type = JUNOS_DFW_TERM_TYPE_ORDERED;
00166                 i_dti.property.order.term_adj_type = JUNOS_DFW_TERM_ADJ_PREV;
00167 
00168                 if(junos_dfw_term_start(trans_hdl, &i_dti,
00169                         JUNOS_DFW_TERM_OP_ADD)) {
00170                     ERRMSG(PED, LOG_ERR,
00171                             "%s: junos_dfw_term_start failed", __func__);
00172                     junos_dfw_trans_handle_free(trans_hdl);
00173                     return;
00174                 }
00175                 
00176                 // Specify term action as redirect (routing-instance)
00177                 // pfd_forwarding is the name of the new VR we just created above
00178                 
00179                 if(junos_dfw_term_action_redirect(trans_hdl, "pfd_forwarding")) {
00180                     ERRMSG(PED, LOG_ERR,
00181                         "%s: junos_dfw_term_action_policer failed", __func__);
00182                     junos_dfw_trans_handle_free(trans_hdl);
00183                     return;
00184                 }
00185                 
00186                 if(junos_dfw_term_end(trans_hdl) < 0) {
00187                     ERRMSG(PED, LOG_ERR,
00188                             "%s: junos_dfw_term_end failed", __func__);
00189                     junos_dfw_trans_handle_free(trans_hdl);
00190                     return;
00191                 }
00192                 
00193                 // Send transaction to finish the filter add
00194                 
00195                 if(junos_dfw_trans_send(dfw_handle, trans_hdl, cid, 0)) {
00196                     ERRMSG(PED, LOG_ERR,
00197                             "%s: junos_dfw_trans_send failed", __func__);
00198                     junos_dfw_trans_handle_free(trans_hdl);
00199                     return;
00200                 }
00201                 
00202                 junos_dfw_trans_handle_free(trans_hdl);
00203                 make_pfd_filter_on_int = NULL;
00204                 update_policies(); // go thru policies to check for PFD filters
00205             }
00206             
00207             return;
00208         } else {
00209             ERRMSG(PED, LOG_ERR, "%s: Found no client ID", __func__);
00210         }
00211     } else if(code == JUNOS_DFW_SC_FAILED_VERSION) {
00212         ERRMSG(PED, LOG_ERR,
00213                 "%s: Connecting to dfwd failed. Bad libdfwd version", __func__);
00214     } else {
00215         ERRMSG(PED, LOG_ERR, "%s: Connecting to dfwd failed", __func__);
00216     }
00217     ready = FALSE;
00218 }
00219 
00220 
00230 static void
00231 session_state_changed(junos_dfw_session_handle_t handle,
00232                       junos_dfw_session_state_t state)
00233 {
00234     INSIST_ERR(handle == dfw_handle);
00235     ERRMSG(PED, LOG_ALERT,
00236            "%s: PED's connection to DFWD going %s", __func__,
00237             (state == JUNOS_DFW_SS_DOWN) ? "DOWN" : "??");
00238     ready = FALSE;
00239     
00240     /*
00241      * release the session handle
00242      */
00243     junos_dfw_session_handle_free(handle);
00244 
00245     dfw_handle = NULL;
00246 
00247     // TODO start a retry timer if you want to handle this error case
00248 }
00249 
00250 
00263 static void
00264 transaction_rejected(junos_dfw_session_handle_t handle, 
00265                      uint64_t ctx, 
00266                      junos_dfw_trans_reject_reason_info_t reason_info)
00267 {
00268     #define ERR_BUF_SIZE 256
00269     char errbuf[ERR_BUF_SIZE];
00270     
00271     INSIST_ERR(handle == dfw_handle);
00272     
00273     junos_dfw_trans_reject_reason_strerr(reason_info, errbuf, ERR_BUF_SIZE);
00274     
00275     ERRMSG(PED, LOG_WARNING, 
00276            "%s: Context %lld failed: %s", __func__, ctx, errbuf);
00277 }
00278 
00279 
00292 static void
00293 transaction_accepted(junos_dfw_session_handle_t handle, 
00294                      uint64_t ctx,
00295                      uint32_t dfw_idx)
00296 {
00297     INSIST_ERR(handle == dfw_handle);
00298     
00299     junos_trace(PED_TRACEFLAG_FILTER, "%s: Context %lld accepted as %d",
00300                 __func__, ctx, dfw_idx);
00301 }
00302 
00303 
00304 
00305 /*** GLOBAL/EXTERNAL Functions ***/
00306 
00307 
00311 boolean
00312 is_pfd_filter_on(void)
00313 {
00314     return pfd_on;
00315 }
00316 
00317 
00321 void
00322 turn_on_pfd_filter(void)
00323 {
00324     pfd_on = TRUE;
00325 }
00326 
00327 
00331 void
00332 turn_off_pfd_filter(void)
00333 {
00334     pfd_on = FALSE;
00335 }
00336 
00337 
00347 int
00348 init_dfw(evContext ctx)
00349 {
00350     int rc;
00351     junos_dfw_client_functions_t funcs;
00352     junos_dfw_conn_addr_t conn_addr;
00353     junos_dfw_sdk_app_id_t app_id;
00354     
00355     junos_trace(PED_TRACEFLAG_FILTER, "%s", __func__);
00356 
00357     ready = FALSE;
00358     dfw_handle = NULL;
00359     make_pfd_filter_on_int = NULL;
00360     
00361     funcs.session_connect_cb = session_connect;
00362     funcs.session_state_change_cb = session_state_changed;
00363     funcs.trans_rejected_cb = transaction_rejected;
00364     funcs.trans_accepted_cb = transaction_accepted;
00365 
00366     rc = junos_dfw_session_handle_alloc(&dfw_handle, &funcs);
00367     
00368     if(rc != 0) {
00369         ERRMSG(PED, LOG_ERR, "%s: Cannot allocate handle for a dynamic "
00370                 "firewall session (%m)", __func__);
00371         dfw_handle = NULL;
00372         return -1;
00373     }
00374     
00375     conn_addr.addr_family = JUNOS_DFW_CONN_AF_INET;
00376     conn_addr.addr.dfwd_inet.dfwd_server_port = JUNOS_DFW_DEFAULT_PORT;
00377         
00378     conn_addr.addr.dfwd_inet.dfwd_host_name = 
00379         malloc(strlen(JUNOS_DFW_DEFAULT_LOCAL_ADDR) + 1);
00380     INSIST_ERR(conn_addr.addr.dfwd_inet.dfwd_host_name != NULL);
00381     strlcpy(conn_addr.addr.dfwd_inet.dfwd_host_name, 
00382             JUNOS_DFW_DEFAULT_LOCAL_ADDR,
00383             strlen(JUNOS_DFW_DEFAULT_LOCAL_ADDR) + 1);
00384     
00385     app_id = 1; // Would be origin ID if done in the RE SDK
00386     
00387     rc = junos_dfw_session_open(dfw_handle, &conn_addr, app_id, ctx);
00388     
00389     if(rc != 0) {
00390         if(errno == EISCONN) {
00391             junos_trace(PED_TRACEFLAG_FILTER, "%s: Connection to DWFD established", __func__);
00392             ready = TRUE;            
00393         } else {
00394             ERRMSG(PED, LOG_ERR, "%s: Cannot setup dynamic firewall connection (%m)",
00395                     __func__);
00396             junos_dfw_session_handle_free(dfw_handle);
00397             dfw_handle = NULL;
00398             return -1;
00399         }
00400     }
00401 
00402     return 0;
00403 }
00404 
00405 
00409 void
00410 shutdown_dfw(void)
00411 {
00412     ready = FALSE;
00413     if(junos_dfw_trans_purge(dfw_handle, &cid, 1)) {
00414         ERRMSG(PED, LOG_ERR, "%s: Failed to perform DFWD purge",
00415                 __func__);
00416     }
00417     
00418     if(dfw_handle) {
00419         junos_dfw_session_close(dfw_handle);
00420         junos_dfw_session_handle_free(dfw_handle);
00421         dfw_handle = NULL;
00422     }
00423 }
00424 
00425 
00426 
00436 boolean
00437 init_pfd_filter(char * interface_name)
00438 {
00439     char *cmd = NULL;
00440     
00441     junos_dfw_term_info_t i_dti;
00442     junos_dfw_trans_handle_t trans_hdl;
00443     
00444     INSIST(interface_name != NULL);
00445     INSIST_ERR(provider_info_get_prefix() != NULL);
00446     
00447     junos_trace(PED_TRACEFLAG_FILTER, "%s(%s)", __func__, interface_name);
00448     
00449     // using op scripts create this config:
00450     
00451     /*
00452     
00453     pfd_forwarding {
00454             instance-type virtual-router;
00455             interface ms-x/y/0.100;
00456     }
00457     
00458     */
00459     if(asprintf(&cmd, "op %s-" INIT_FILTER_FILENAME " interface %s ", 
00460             provider_info_get_prefix(), interface_name) < 0) {
00461         ERRMSG(PED, LOG_ERR,
00462                 "%s: Assemble command failed!", __func__);
00463         return FALSE;
00464     } 
00465     if(exec_op_script(cmd) < 0) {
00466         ERRMSG(PED, LOG_ERR,
00467                 "%s: Execute script failed!", __func__);
00468         free(cmd);
00469         return FALSE;
00470     }
00471 
00472     free(cmd);
00473     
00474     if(!ready) {
00475         ERRMSG(PED, LOG_WARNING,
00476                 "%s: PFD filter not created due to DFW != ready", __func__);
00477         make_pfd_filter_on_int = strdup(interface_name);
00478         return TRUE;
00479     }
00480 
00481     // Create filter pointing to PFD routing instance
00482     
00483     bzero(&pfd_filter_info, sizeof(pfd_filter_info));
00484     snprintf(pfd_filter_info.namestr_key, sizeof(pfd_filter_info.namestr_key),
00485             "TO_PFD_ON_INGRESS");
00486     pfd_filter_info.owner_client_id = cid;
00487     pfd_filter_info.addr_family = JUNOS_DFW_FILTER_AF_INET;
00488 
00489     pfd_filter_info.type = JUNOS_DFW_FILTER_TYPE_CLASSIC;
00490 
00491     // Create the filter add transaction 
00492     
00493     if(junos_dfw_filter_trans_alloc(&pfd_filter_info,
00494             JUNOS_DFW_FILTER_OP_ADD, &trans_hdl)) {
00495         ERRMSG(PED, LOG_ERR,
00496                 "%s: junos_dfw_filter_trans_alloc failed", __func__);
00497         return FALSE;
00498     }
00499 
00500     // Add a term to the filter
00501     
00502     bzero(&i_dti, sizeof(i_dti));
00503     strlcpy(i_dti.namestr_key, "TO_PFD_TERM", sizeof(i_dti.namestr_key));
00504     i_dti.type = JUNOS_DFW_TERM_TYPE_ORDERED;
00505     i_dti.property.order.term_adj_type = JUNOS_DFW_TERM_ADJ_PREV;
00506 
00507     if(junos_dfw_term_start(trans_hdl, &i_dti, JUNOS_DFW_TERM_OP_ADD)) {
00508         ERRMSG(PED, LOG_ERR, "%s: junos_dfw_term_start failed",
00509                 __func__);
00510         goto failed;
00511     }
00512     
00513     // Specify term action as redirect (routing-instance)
00514     // pfd_forwarding is the name of the new VR we just created above
00515     
00516     if(junos_dfw_term_action_redirect(trans_hdl, "pfd_forwarding")) {
00517         ERRMSG(PED, LOG_ERR, "%s: junos_dfw_term_action_policer failed",
00518                 __func__);
00519         goto failed;
00520     }
00521     
00522     if(junos_dfw_term_end(trans_hdl) < 0) {
00523         ERRMSG(PED, LOG_ERR, "%s: junos_dfw_term_end failed", __func__);
00524         goto failed;
00525     }
00526     
00527     // Send transaction to finish the filter add
00528     
00529     if(junos_dfw_trans_send(dfw_handle, trans_hdl, cid, 0)) {
00530         ERRMSG(PED, LOG_ERR,"%s: junos_dfw_trans_send failed",__func__);
00531         goto failed;
00532     }
00533     
00534     junos_dfw_trans_handle_free(trans_hdl);
00535     return TRUE;
00536 
00537 failed:
00538     junos_dfw_trans_handle_free(trans_hdl);
00539     return FALSE;
00540 }
00541 
00542 
00543 
00544 
00554 boolean
00555 apply_pfd_filter_to_interface(char * interface_name)
00556 {
00557     char *ifname = NULL;
00558     int unit;
00559     junos_dfw_filter_attach_info_t dfai;
00560     junos_dfw_trans_handle_t trans_hdl;
00561 
00562     INSIST(interface_name != NULL);
00563     
00564     junos_trace(PED_TRACEFLAG_FILTER, "%s(%s)", __func__, interface_name);
00565     
00566     ifname = strdup(interface_name);
00567     if(ifname == NULL) {
00568         ERRMSG(PED, LOG_ERR,
00569                 "%s: Duplicate interface name failed!", __func__);
00570         return FALSE;
00571     }
00572     if((unit = get_unit(ifname) < 0)) {
00573         ERRMSG(PED, LOG_ERR,
00574                 "%s: Get unit number failed!", __func__);
00575         free(ifname);
00576         return FALSE;
00577     }
00578     
00579     if(!pfd_on) {
00580         free(ifname);
00581         return TRUE;
00582     }
00583     
00584     if(!ready) {
00585         ERRMSG(PED, LOG_WARNING,
00586                 "%s: PFD filter not attached due to DFW != ready", __func__);
00587         free(ifname);
00588         return TRUE;
00589     }
00590     
00591     // Apply the PFD filter to the interface
00592     
00593     dfai.attach_point = JUNOS_DFW_FILTER_ATTACH_POINT_INPUT_INTF;
00594     strlcpy(dfai.type.intf.ifd_name, ifname,
00595             sizeof(dfai.type.intf.ifd_name));
00596     dfai.type.intf.sub_unit = unit;
00597     
00598     free(ifname);
00599     
00600     if(junos_dfw_filter_attach_trans_alloc(&pfd_filter_info,
00601             &dfai, &trans_hdl)){
00602         ERRMSG(PED, LOG_ERR,
00603                 "%s: junos_dfw_filter_attach_trans_alloc failed", __func__);
00604         junos_dfw_trans_handle_free(trans_hdl);
00605         return FALSE;
00606     }
00607     
00608     if(junos_dfw_trans_send(dfw_handle, trans_hdl, cid, 0)) {
00609         ERRMSG(PED, LOG_ERR,
00610                 "%s: junos_dfw_trans_send (attach) failed", __func__);
00611         junos_dfw_trans_handle_free(trans_hdl);
00612         return FALSE;
00613     }
00614     
00615     junos_dfw_trans_handle_free(trans_hdl);
00616     return TRUE;
00617 }
00618 
00619 
00620 
00627 void
00628 remove_pfd_filter_from_interface(char * interface_name)
00629 {
00630     char *ifname = NULL;
00631     int unit;
00632     junos_dfw_filter_attach_info_t dfai;
00633     junos_dfw_trans_handle_t trans_hdl;
00634     
00635     INSIST(interface_name != NULL);
00636 
00637     junos_trace(PED_TRACEFLAG_FILTER, "%s(%s)", __func__, interface_name);
00638     
00639     ifname = strdup(interface_name);
00640     if(ifname == NULL) {
00641         ERRMSG(PED, LOG_ERR,
00642                 "%s: Duplicate interface name failed!", __func__);
00643     
00644     } 
00645     if((unit = get_unit(ifname) < 0)) {
00646         ERRMSG(PED, LOG_ERR,
00647                 "%s: Get unit number failed!", __func__);
00648         free(ifname);
00649         return;
00650     }
00651     
00652     if(!pfd_on) {
00653         free(ifname);
00654         return;
00655     }
00656     
00657     if(!ready) {
00658         ERRMSG(PED, LOG_WARNING,
00659                 "%s: PFD filter not detached due to DFW != ready", __func__);
00660         free(ifname);
00661         return;
00662     }
00663     
00664     // detach the PFD filter from the interface
00665     
00666     dfai.attach_point = JUNOS_DFW_FILTER_ATTACH_POINT_INPUT_INTF;
00667     strlcpy(dfai.type.intf.ifd_name, ifname, sizeof(dfai.type.intf.ifd_name));
00668     dfai.type.intf.sub_unit = unit;
00669     
00670     free(ifname);
00671     
00672     if(junos_dfw_filter_detach_trans_alloc(&pfd_filter_info, &dfai, 
00673             &trans_hdl)){
00674         ERRMSG(PED, LOG_ERR,
00675                 "%s: junos_dfw_filter_detach_trans_alloc failed", __func__);
00676         junos_dfw_trans_handle_free(trans_hdl);
00677         return;
00678     }
00679     
00680     if(junos_dfw_trans_send(dfw_handle, trans_hdl, cid, 0)) {
00681         ERRMSG(PED, LOG_ERR,
00682                 "%s: junos_dfw_trans_send (attach) failed", __func__);
00683         junos_dfw_trans_handle_free(trans_hdl);
00684         return;
00685     }
00686     
00687     junos_dfw_trans_handle_free(trans_hdl);
00688 }
00689 
00690 
00703 boolean
00704 apply_filters_to_interface(
00705             char * interface_name,
00706             ped_policy_filter_t * filters)
00707 {
00708     char *ifname = NULL;
00709     char *cmd = NULL;
00710     int unit;
00711 
00712     INSIST(interface_name != NULL);
00713     INSIST(filters != NULL);
00714     
00715     junos_trace(PED_TRACEFLAG_FILTER, "%s(%s)", __func__, interface_name);
00716     
00717     // using op scripts apply all filters
00718     
00719     ifname = strdup(interface_name);
00720     if(ifname == NULL) {
00721         ERRMSG(PED, LOG_ERR,
00722                 "%s: Duplicate interface name failed!", __func__);
00723         return FALSE;
00724     }
00725     if((unit = get_unit(ifname) < 0)) {
00726         ERRMSG(PED, LOG_ERR,
00727                 "%s: Get unit number failed!", __func__);
00728         free(ifname);
00729         return FALSE;
00730     }
00731     if(asprintf(&cmd, "op %s-" APPLY_FILTER_FILENAME
00732             " interface %s unit %d %s %s %s %s",
00733             provider_info_get_prefix(), 
00734             ifname, unit,
00735             filters->filter_data.input_filter[0] ? "input" : "",
00736             filters->filter_data.input_filter[0] ?
00737                     filters->filter_data.input_filter : "",
00738             filters->filter_data.output_filter[0] ? "output" : "",
00739             filters->filter_data.output_filter[0] ?
00740                     filters->filter_data.output_filter : "") < 0) {
00741         
00742         ERRMSG(PED, LOG_ERR,
00743                 "%s: Assemble command failed!", __func__);
00744         
00745         free(ifname);
00746         free(cmd);
00747         return FALSE;    
00748     }
00749     if(exec_op_script(cmd) < 0) {
00750         ERRMSG(PED, LOG_ERR,
00751                 "%s: Execute script failed!", __func__);
00752         free(ifname);
00753         free(cmd);
00754         return FALSE;
00755     }
00756 
00757     free(cmd);
00758     free(ifname);
00759     
00760     return TRUE;
00761 }
00762 
00763 
00773 boolean
00774 remove_filters_from_interface(char * interface_name)
00775 {
00776     char *ifname = NULL;
00777     char *cmd = NULL;
00778     int unit;
00779 
00780     INSIST(interface_name != NULL);
00781     
00782     junos_trace(PED_TRACEFLAG_FILTER, "%s(%s)", __func__, interface_name);
00783 
00784     ifname = strdup(interface_name);
00785     if(ifname == NULL) {
00786         ERRMSG(PED, LOG_ERR,
00787             "%s: Duplicate interface name failed!", __func__);
00788         return FALSE;
00789     }
00790     if((unit = get_unit(ifname) < 0)) {
00791         ERRMSG(PED, LOG_ERR,
00792             "%s: Get unit number failed!", __func__);
00793         free(ifname);
00794         return FALSE;
00795     }
00796     if(asprintf(&cmd, "op %s-" APPLY_FILTER_FILENAME
00797             " interface %s unit %d",
00798             provider_info_get_prefix(),
00799             ifname, unit) < 0) {
00800         
00801         ERRMSG(PED, LOG_ERR,
00802                 "%s: Assemble command failed!", __func__);
00803         
00804         free(ifname);
00805         return FALSE;
00806 
00807     }
00808     if(exec_op_script(cmd) < 0) {
00809         ERRMSG(PED, LOG_ERR,
00810                 "%s: Execute script failed!", __func__);
00811         free(ifname);
00812         free(cmd);
00813         return FALSE;
00814     }
00815     
00816     free(ifname);
00817     free(cmd);
00818     return TRUE;
00819 }

2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:27:06 2010 for SDK Your Net Corporation Policy Manager Example: Policy Enforcement Daemon 1.0 by Doxygen 1.5.1